function change_permission(){
	var str = $("#permission_list option:selected").val();
	$("#permission").val(str);
}
function add_book(){
	popShow({ title: "添加书籍", ele: "#addform", width: 468 });	
}
function add_book_type(){
	popShow({ title: "添加书籍类型", ele: "#addform", width: 468 });	
}
function add_manager(){
	popShow({ title: "添加管理员", ele: "#addform", width: 468 });	
}
function add_book_comment(){
	popShow({ title: "新增评论", ele: "#addform", width: 468 });
	var bookId =getUrlParam("bookId");
	$("#critic").val($.cookie('id'));
	$("#bookId").val(bookId);
}
function numberDown(){
	var number = 0.0;
	number = parseFloat($("#change_balance").val())-20;
	$("#number").val(number);
	$("#change_balance").val(number);
}
function numberUp(){
	var number = 0.0;
	number = parseFloat($("#change_balance").val())+20;
	$("#number").val(number);
	$("#change_balance").val(number);
}
function userInfo(){
	if($.cookie('name')){
		$(".user-info").append("欢迎您<br />"+$.cookie('name'));
	} else{
		$(".user-info").append("欢迎您<br />"+$.cookie('id'));
	}	
}
function changeframe(framename) {         
	var htmlname = $(framename).attr("name")+".html";
	$("#urlIframe").attr("src",htmlname);
}
function readingLogSearchCondition(){
	if($.cookie('permission')==0){
		$(".CSSearchTbl").append('<tr> <td class="left">读者编号：</td> <td class="right"><input type="text" name="peruserId" size="12"  /></td> <td class="left">书籍编号：</td> <td class="right"><input type="text" name="bookId" size="12"  /></td> <td class="left">创建时间：</td> <td class="right"><input type="text" name="timeBegin" size="8" class="datePicker" /> 至 <input type="text" name="timeEnd" size="8" class="datePicker" /></td> <td class="right" colspan="2"> <button id="searchButton" class="btn btn-primary pull-left col-sm-12" data-dismiss="modal"> 开始搜索 <i class="ace-icon fa fa-search"></i> </button> </td> </tr>');
	} else{
		$(".CSSearchTbl").append('<tr> <td class="left">书籍编号：</td> <td class="right"><input type="text" name="bookId" size="12"  /> <input id="peruserId" name="peruserId" value="'+$.cookie('id')+'" type="text" style="display:none;"/></td> <td class="left">创建时间：</td> <td class="right"><input type="text" name="timeBegin" size="8" class="datePicker" /> 至 <input type="text" name="timeEnd" size="8" class="datePicker" /></td> <td class="right" colspan="2"> <button id="searchButton" class="btn btn-primary pull-left col-sm-12" data-dismiss="modal"> 开始搜索 <i class="ace-icon fa fa-search"></i> </button> </td> </tr>');
	}	
}
function navbarCreate(){
var permission = $.cookie('permission');
	switch(permission){
		case "0":{
			$("#sidebar").append('<ul class="nav nav-list"><li class="active"><a href="../html/index.html"><i class="menu-icon fa fa-tachometer"></i><span class="menu-text"> 首页 </span></a><b class="arrow"></b></li><li class="" onclick="changelistatus()"><a href="../#" class="dropdown-toggle"><i class="menu-icon fa fa-desktop"></i><span class="menu-text"> 书籍&amp;书籍类型管理</span> <b class="arrow fa fa-angle-down"></b> </a> <b class="arrow"></b> <ul class="submenu"> <li class="" onclick="changelistatus_2(this)"> <a name="book" onclick="changeframe(this)"> <i class="menu-icon fa fa-caret-right"></i> 小说管理 </a> <b class="arrow"></b> </li> <li class="" onclick="changelistatus_2(this)"> <a name="bookType" onclick="changeframe(this)"> <i class="menu-icon fa fa-caret-right"></i> 小说类型管理 </a> <b class="arrow"></b> </li> </ul> </li><li class="" onclick="changenavstatus(this)"> <a name="section" onclick="changeframe(this)"> <i class="menu-icon fa fa-desktop"></i> <span class="menu-text">小说章节管理</span> </a> </li><li class="" onclick="changenavstatus(this)"> <a name="bookcomment" onclick="changeframe(this)"> <i class="menu-icon fa fa-desktop"></i> <span class="menu-text">小说评论管理</span> </a> </li> <li class="" onclick="changenavstatus(this)"> <a name="manager" href="javascript:void(0);" onclick="changeframe(this)"> <i class="menu-icon fa fa-list-alt"></i> <span class="menu-text"> 管理员管理 </span> </a> <b class="arrow"></b> </li> <li class="" onclick="changenavstatus(this)"> <a name="user" onclick="changeframe(this)"> <i class="menu-icon fa fa-desktop"></i> <span class="menu-text">用户管理</span> </a> </li> <li class="" onclick="changenavstatus(this)"> <a name="readingLog" onclick="changeframe(this)"> <i class="menu-icon fa fa-desktop"></i> <span class="menu-text">浏览记录</span> </a> </li></ul><div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse"> <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i> </div>');
			break;
		}
		case "1":{
			$("#sidebar").append('<ul class="nav nav-list"><li class="active"><a href="../html/index.html"><i class="menu-icon fa fa-tachometer"></i><span class="menu-text"> 首页 </span></a><b class="arrow"></b></li><li class="" onclick="changenavstatus(this)"> <a name="book" href="javascript:void(0);" onclick="changeframe(this)"> <i class="menu-icon fa fa-list-alt"></i> <span class="menu-text"> 小说列表 </span> </a> <b class="arrow"></b> </li> <li class="" onclick="changenavstatus(this)"> <a name="readingLog" onclick="changeframe(this)"> <i class="menu-icon fa fa-desktop"></i> <span class="menu-text">浏览记录</span> </a> </li></ul><div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse"> <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i> </div>');
			break;
		}
	}	
}
function changenavstatus(nav) {
	$(".open").attr("class","");
	$(".active").attr("class","");
	$(".submenu").attr("style","display:none;");
	$(nav).attr("class","active open status");
}
function changelistatus() {
	$(".status").attr("class","");
}
function changelistatus_2(now) {
	$(".active").attr("class","");
	$(now).attr("class","active");
}
function add_section(){
	popShow({ title: "添加书籍新章节", ele: "#addform", width: 468 });	
}